# CMake File for installing pkgconfig files for libdragonscript
# Copyright (C) 2009 Hajime Yoshimori <RoarLudros@gmail.com>
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

cmake_minimum_required(VERSION 2.6)

file(GLOB CMAKE_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/*.cmake)
list(GET CMAKE_MODULE_PATH 0 CMAKE_MODULE_INSTALL_PATH)
install(FILES ${CMAKE_MODULES} DESTINATION "${CMAKE_MODULE_INSTALL_PATH}")

if(NOT UNIX)
  return()	# pkgconfig is not need in Windows or Macintosh.
endif(NOT UNIX)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libdragonscript.pc.in" 
			   "${CMAKE_CURRENT_BINARY_DIR}/libdragonscript.pc" @ONLY)
  
if(NOT PKGCONFIG_PATH)
  set(PKGCONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_LIBRARY_PATH}/pkgconfig")
endif(NOT PKGCONFIG_PATH)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdragonscript.pc DESTINATION "${PKGCONFIG_PATH}")

